package quickcheck;

import net.java.quickcheck.Generator;
import net.java.quickcheck.generator.PrimitiveGenerators;

/**
 * 
 * @author Virag
 *
 */
class Name {
	private final String first;
	private final String last;

	/**
	 * 
	 * @param first
	 * @param last
	 */
	public Name(String first, String last) {
		super();
		this.first = first;
		this.last = last;
	}

	/**
	 * 
	 * @return
	 */
	public String getLast() { 
		return last; 
	}

	/**
	 * 
	 * @return
	 */
	public String getFirst() { 
		return first; 
	}

	/**
	 * 
	 */
	public boolean equals(Object o){
		Name n = (Name)o;
		return n.first.equals(this.first) &&
		n.last.equals(this.last);
	}

	/**
	 * 
	 */
	public int hashCode(){
		return this.first.hashCode() * this.last.hashCode();
	}
}

/**
 * 
 * @author Virag
 *
 */
class NameGenerator implements net.java.quickcheck.Generator<Name>{
	Generator<String> first = PrimitiveGenerators.strings();
	Generator<String> last = PrimitiveGenerators.strings();

	/**
	 * 
	 */
	@Override 
	public Name next() {
		return new Name(first.next(), last.next());
	}
}


